package com.qianf.wisdomOrientation.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.qianf.wisdomOrientation.entity.Reply;
import com.qianf.wisdomOrientation.entity.ResponseData;
import com.qianf.wisdomOrientation.service.ReplyService;
import com.sun.org.apache.regexp.internal.RE;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mkHeart
 * @since 2021-07-08
 */
@RestController
@RequestMapping("/wisdomOrientation/reply")
public class ReplyController {
    @Autowired
    private ReplyService service;

    // produces = "application/json" 返回数据时json 数据
    @ApiOperation(value = "添加消息  ", produces = "application/json")
    @RequestMapping(path = "/addMessage", method = RequestMethod.GET)

    public ResponseData addMessage(Reply reply) {
        ResponseData<Object> responseData = new ResponseData<>();

        int i = service.addReply(reply);
        if (i > 0) {
            responseData.setCode(1);
            responseData.setMsg("添加成功");
            return responseData;
        } else {
            responseData.setCode(0);
            return responseData;
        }
    }
}

